<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload = function(){
            //1. 用apply的情况
            var arr1 = [1,2,4,5,7,3,321];
            console.log( Math.max.apply(null,arr1) )

            //2. 用bind的情况
            var btn = document.getElementById('btn');
            var h1s = document.getElementById('h1s');
            btn.onclick = function(){
                console.log( this.id );//this指向h1s
            }.bind(h1s)
        }
    </script>
</head>
<body>
    <div id="btn" style="width:50px;height:50px;background-color: pink;"></div>
    <div id="h1s" style="width:50px;height:50px;background-color: yellow;"></div>
</body>
</html>